<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('Wechat/index')}">微信菜单设置</a></li>
        <li class="active"><a href="{:url('Wechat/add')}">添加菜单</a></li>
    </ul>
    <form class="form-horizontal js-ajax-form margin-top-20" action="{:url('Wechat/addPost')}" method="post">
        <div class="form-group">
            <label for="js-parent_id" class="col-sm-2 control-label">微信账号</label>
            <div class="col-md-6 col-sm-10">
                <select name="account" id="js-account" class="form-control">
                    <foreach name="accounts" key="account" item="item">
                        <if condition="$defaultAccount eq $account">
                            <option value="{$account}" selected>{$account}</option>
                            <else/>
                            <option value="{$account}">{$account}</option>
                        </if>

                    </foreach>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="js-parent_id" class="col-sm-2 control-label">上级菜单</label>
            <div class="col-md-6 col-sm-10">
                <select name="parent_id" id="js-parent_id" class="form-control">
                    <option value="0">-----顶级----</option>
                    <volist name="parents" id="p">
                        <option value="{$p.id}">
                            {$p.name}
                        </option>
                    </volist>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">菜单名称</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-name" name="name">
            </div>
        </div>
        <div class="form-group">
            <label for="input-type" class="col-sm-2 control-label">菜单类型</label>
            <div class="col-md-6 col-sm-10">
                <label class="button">
                    <input name="type" value="view" class="type-check" type="radio" id="view" >
                    <span class="icon icon-check"></span> 跳转链接
                </label>
                <label class="button">
                    <input name="type" value="click" class="type-check" type="radio" id="click">
                    <span class="icon icon-check"></span> 点击事件
                </label>
            </div>
        </div>
        <div class="form-group" style="display: none" id="form-url">
            <label for="url" class="col-sm-2 control-label">链接地址</label>
            <div class="col-md-6 col-sm-10">
                <input size="50" type="text" class="form-control" id="url" name="url" placeholder="请输入菜单所指向的链接地址">
            </div>
        </div>
        <div class="form-group" style="display: none" id="form-key">
            <label for="key" class="col-sm-2 control-label">回复文字</label>
            <div class="col-md-6 col-sm-10">
                <input size="50" type="text" class="form-control" id="key" name="key" placeholder="请输入点击菜单后回复的文字">
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    $("#view").click(function () {
        $("#form-url").css('display', '');
        $("#form-key").css('display', 'none');
    });
    $("#click").click(function () {
        $("#form-url").css('display', 'none');
        $("#form-key").css('display', '');
    });
</script>
</body>
</html>
